<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/index_work.css">
</head>
<body>
<form action="${pageContext.request.contextPath}/employee" method="post">
    <table>
        <tr>
            <th colspan="2">Add Employee</th>
        </tr>
        <tr>
            <td>lastName</td>
            <td>
                <input type="text" name="lastName">
            </td>
        </tr>
        <tr>
            <td>email</td>
            <td>
                <input type="email" name="email">
            </td>
        </tr>
        <tr>
            <td>gender</td>
            <td>
                <input type="radio" name="gender" value="1">male
                <input type="radio" name="gender" value="0">female
            </td>
        </tr>
        <tr>
            <td>department</td>
            <td>
                <%--通过department.id为部门的id进行赋值--%>
                <select name="department.id">
                    <c:forEach items="${requestScope.departments}" var="department">
                        <%--下拉框提交时，提交的是value属性的值，要为员工分配部门，需要先知道部门的id--%>
                        <option value="${pageScope.department.id}">${pageScope.department.departmentName}</option>
                    </c:forEach>
                </select>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="submit" value="add">
            </td>
        </tr>
    </table>
</form>
</body>
</html>
